package com.mouchel.gwt.xpath.client.impl;

import java.util.List;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.xml.client.Element;

public class XPathImplMozilla extends XPathImpl
{
	@Override
	protected native void evaluateImpl(Element element, String xpath, List<JavaScriptObject> results) /*-{
		var jso = @com.google.gwt.xml.client.impl.XPathUtil::getJsObject(Lcom/google/gwt/xml/client/Node;)(element);
		var nodes = jso.ownerDocument.evaluate(xpath, jso, null, XPathResult.ANY_TYPE, null);
		
		var currentNode = nodes.iterateNext();
		while (currentNode)
		{
			//results.add(currentNode);
			results.@java.util.List::add(Ljava/lang/Object;)(currentNode);
			currentNode = nodes.iterateNext();
		}
	}-*/;	
}
